package leetcode_401_500;

public class LeeCode_461 {
    public static void main(String[] args) {
        System.out.println(hammingDistance(1, 4));
    }
    private static int hammingDistance(int x, int y) {
        int ans = 0;
        while (x != 0 || y != 0) {
            int n1 = x & 1;
            int n2 = y & 1;
            if (n1 != n2){
                ans++;
            }
            x >>>= 1;
            y >>>= 1;
        }
        return ans;
    }
}
